package com.hitfm.iplay.util;

import java.sql.Date;
import java.text.DateFormat;
import java.util.Calendar;

import android.content.Context;
import android.util.Log;

public class ConvertTime {
	public static String milliToSecs(long milliSecs) {
		if (milliSecs <= 0) {
			return "00:00";
		}
		StringBuffer sb = new StringBuffer();
		long m = milliSecs / (60 * 1000);
		sb.append(m < 10 ? "0" + m : m);
		sb.append(":");
		long s = (milliSecs % (60 * 1000)) / 1000;
		sb.append(s < 10 ? "0" + s : s);
		return sb.toString();
	}
	
	public static String formatDateString(Context context, long time) {
        DateFormat dateFormat = android.text.format.DateFormat
                .getDateFormat(context);
        DateFormat timeFormat = android.text.format.DateFormat
                .getTimeFormat(context);
        Date date = new Date(time);
        return dateFormat.format(date) + " " + timeFormat.format(date);
    }
}
